using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace DigitalTrainSuite.UserControls
{

	public partial class UserControlTrainInfo : UserControl
	{
		private DataSetLayout.TrainRow row;

		public UserControlTrainInfo()
		{
			InitializeComponent();
		}

		public DataSetLayout.TrainRow Row
		{
			get { return this.row; }
			set 
			{ 
				this.row = value;
				this.textBox1.Text = row.name;
				this.textBox2.Text = row.locoAddress.ToString();
			}
		}

		private void textBox1_TextChanged(object sender, EventArgs e)
		{
			this.row.name = this.textBox1.Text;
		}

		private void textBox2_TextChanged(object sender, EventArgs e)
		{
			try
			{
				this.row.locoAddress = Convert.ToInt32(this.textBox2.Text);
			}
			catch
			{
				this.textBox2.Text = "";
			}
		}


	}
}
